home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / lang / p_image1.sit / LSP Source / LeastSquares.p < prev    next >
Encoding:
Text File  |  1989-07-31  |  1.9 KB  |  49 lines

  1. unit LeastSquares;
  2.  
  3. {This is a stub version of the least squares curve fitting module required to compile the Image program.}
  4. {When you compile with this version you will get a beep when you try to use the Calibrate command.}
  5. {If you really need to calibrate to density standards you will need to purchase the Turbo Pascal Numerical Methods}
  6. {Toolbox for the Macintosh(which is supplied in source form), or to write you own least squares fitting routine. }
  7. {If you do decide to write you own routine, and are willing to make it public, please let me know.}
  8.  
  9.  
  10. {When compiling the module from the Numerical Methods package with Lightspeed Pascal, you will}
  11. {need to make some changes, shown below, in the three places where the nonstandard FillChar routine is used.}
  12.  
  13.  
  14. {FillChar(OldConversionVec, SizeOf(OldConversionVec), 0);}
  15. {for i := 1 to TnRowSize do  OldConversionVec[i] := 0.0;}
  16.  
  17. {FillChar(Solution, SizeOf(Solution), 0);}
  18. {for i := 1 to TNRowSize do Solution[i] := 0.0;}
  19.  
  20. {FillChar(Basis[Index]^, SizeOf(Basis[Index]^), 0);}
  21. {for i := 1 to TNRowSize d Basis[index]^[i] := 0.0;}
  22.  
  23.  
  24. {You may also need to remove some of the comments before LSP will accept the entire file.}
  25.  
  26. interface
  27.  
  28.  
  29.     const
  30.         TNRowSize = 20;
  31.         TNColumnSize = 300;
  32.  
  33.     type
  34.         TNColumnVector = array[1..TNColumnSize] of Extended;
  35.         TNRowVector = array[1..TNRowSize] of Extended;
  36.         TNmatrix = array[1..TNColumnSize] of ^TNRowVector;
  37.         TNSquareMatrix = array[1..TNRowSize] of TNRowVector;
  38.         TNString40 = string[40];
  39.         FitType = (Expo, Fourier, Log, Poly, Power, User);
  40.  
  41.     procedure LeastSquares (NumPoints: integer; var XData: TNColumnVector; var YData: TNColumnVector; NumTerms: integer; var Solution: TNRowVector; var YFit: TNColumnVector; var Residuals: TNColumnVector; var StandardDeviation: Extended; var Variance: Extended; var Error: byte; Fit: FitType);
  42.  
  43. implementation
  44.  
  45.     procedure LeastSquares;
  46.     begin
  47.         error := 111;
  48.     end;
  49. end. { LeastSquares }